import os
import uuid
basedir=os.path.abspath(os.path.dirname(__file__))  # 获取绝对路径


def fileupload(file):
    url=basedir+'/static/upload/'
    filename=uuid.uuid1().hex
    if not os.path.exists(url):
        os.makedirs(url)
    name=filename+"."+file.filename.split(".")[-1]
    file.save(url+name)
    return "/static/upload/"+name